//Example Controller
function ExampleController() {
}

ExampleController.prototype = new GridController();
ExampleController.prototype.constructor = ExampleController;

ExampleController.prototype.initialize = function(dialogView, gridView, masterEntityID, rowClassElement, tableIDElement){

    this._dialogView = dialogView;
    this._gridView = gridView;
    this._masterEntityID = masterEntityID;

    this._createURL = "/Order/CreateExample/";
    this._editURL = "/Order/UpdateExample/";
    this._rowclassElement = rowClassElement;
    this._tableIDElement = tableIDElement;

}

ExampleController.prototype.handleCreate = function() {
    this._editMode = false;

    $('#selectColumnA').val("");
    $('#txtColumnB').val("");
    this.showDialog();
    return false;
}

ExampleController.prototype.editRow = function(id, rowID){
    var container = this;
    //Get latest data from server
    $.post('/Order/GetExample/' + id, null,
        function (ExampleItem) {
            container._editMode = true;
            container._editEntityID = id;
            container._editEntityRowID = rowID;
            $('#selectColumnA').val(ExampleItem.Location);
            $('#txtColumnB').val(ExampleItem.OEMSerialNumber);
            
            $.uniform.update('select');

            container.showDialog();
        }, 'json');

}


ExampleController.prototype.GetNewEntityJSON = function(id) {
    var json = {
                    parentID: id,
                    columnAID: $('#selectColumnA').val(),
                    columnB: $('#txtColumnB').val()
                };
    return json;
}

ExampleController.prototype.getEntityValues = function(){
    var entityValues = new Array();
    entityValues[0]  = $('#selectColumnA option:selected').text();
    entityValues[1] =  $('#txtColumnB').val();
    return entityValues;
}

